package com.shop.cereshop.commons.enums.feedback;

import lombok.Getter;

/**
 * @description: TODO 
 * @author lx
 * @date 2025/10/23 14:46
 * @version 1.0
 */
@Getter
public enum FeedbackUserTypeEnum {
    //0-匿名
    ANONYMOUS(0, "匿名"),
    //1-普通用户
    USER(1, "普通用户"),
    //2-店铺
    SHOP(2, "店铺"),
    //3-业务员
    SALESPERSON(3, "业务员"),
    //4-代理商
    AGENT(4, "代理商"),
    //5-股东
    STOCKHOLDER(5, "股东");

    private Integer code;
    private String msg;

    private FeedbackUserTypeEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return this.code;
    }

    public String getMsg() {
        return this.msg;
    }

    public static FeedbackUserTypeEnum getByCode(Integer code) {
        for (FeedbackUserTypeEnum value : values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }

    public static String getMsgByCode(Integer code) {
        for (FeedbackUserTypeEnum value : values()) {
            if (value.getCode().equals(code)) {
                return value.getMsg();
            }
        }
        return null;
    }

    public static Integer getCodeByMsg(String msg) {
        for (FeedbackUserTypeEnum value : values()) {
            if (value.getMsg().equals(msg)) {
                return value.getCode();
            }
        }
        return null;
    }
}
